package cn.ly.link.data;

import cn.ly.link.Node;

public class LinkList<E> {
	
	private Node first;
	public LinkList(){
		first = null;
	}
	
	public boolean isEmpty(){
		return first == null;
	}
	
	public void insertFirst(E e){
		Node newNode = new Node(e);
		newNode.next = this.first;
		this.first = newNode;
	}
	
	public E removeFirst(){
		Node temp = this.first;
		this.first = first.next;
		return (E)temp.data;
	}
	
	public void display(){
		Node cur = first;
		while(cur != null){
			cur.display();
			cur = cur.next;
		}
		System.out.println();
	}
	
	

}
